//
// Created by tanke on 23-12-1.
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>

bool isPalindrome(int x)
{
    char valStr[1024] = {0};
    char revValStr[1024] = {0};
    int index = 0;

    memset(valStr, 0, 1024);
    memset(revValStr, 0, 1024);

    if (x == 0) {
        return true;
    }
    if (x < 0) {
        return false;
    }

    sprintf(valStr, "%d", x);

    while (x > 0) {
        revValStr[index] = (x % 10) + '0';
        index += 1;
        x /= 10;
    }

    if (strlen(revValStr) != strlen(valStr)) {
        return false;
    }

    return strncmp(revValStr, valStr, strlen(valStr)) == 0;
}

int main(void)
{
    printf("%d\n", isPalindrome(121));
    return 0;
}
